<template>
    <div class="main order-detail">
        <el-tabs v-model="tab" type="border-card">
            <el-tab-pane label="订单信息" name="1" v-loading="pageLoading">
                <ul class="form-list col-2">
                    <li class="form-item">
                        <span class="item-title">编号:</span>
                        <p v-text="info.orderNo"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">状态:</span>
                        <p v-text="states[info.status + '']"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">用户:</span>
                        <p v-text="`${info.realName} ${info.userMobile}`"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">收货人:</span>
                        <p v-text="`${info.consignee} ${info.mobile}`"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">收货地址:</span>
                        <p v-text="`${info.country} ${info.province} ${info.city} ${info.address}`"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">备注:</span>
                        <p v-text="info.remark"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">下单时间:</span>
                        <p v-text="formatDate(info.createdAt, 'YYYY-MM-DD HH:mm:ss')"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">状态更新时间:</span>
                        <p v-text="formatDate(info.updatedAt, 'YYYY-MM-DD HH:mm:ss')"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">E3单号:</span>
                        <p v-text="info.e3OrderNo"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">最后同步时间:</span>
                        <p v-text="formatDate(info.lastSyncTime, 'YYYY-MM-DD HH:mm:ss')"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">订单类别:</span>
                        <!--<p v-text="types[info.type + ''] || info.type">{{orderType(info)}}</p>-->
                        <p>{{orderType(info)}}</p>
                    </li>
                    <!--<li class="form-item">
                        <span class="item-title">商户号:</span>
                        <p v-text="info.orderNo"></p>
                    </li>-->
                    <li class="form-item">
                        <span class="item-title">物流:</span>
                        <p v-text="info.com"></p>
                    </li>
                    <li class="form-item">
                        <span class="item-title">物流订单号:</span>
                        <p v-text="info.expressNo"></p>
                    </li>
                    <li class="form-item" v-if="info.boxGiftStatus !== null">
                      <span class="item-title">激活状态:</span>
                      <p>{{activeStatus[info.boxGiftStatus]}}</p>
                    </li>
                </ul>
                <h4 class="title">
                  <div>订单明细</div><div class="refund-money">订单已退款金额：{{hadRefundMoney}}</div>
                  <!--<el-button v-if="refundPermissionFlag && refundAllBtnFlag && orderStatusFlag" type="danger" size="mini" plain @click="showRefund(false)">{{(info.status===2 || info.status===10)?'全部退款':'全部退货退款'}}</el-button>-->
                </h4>
                <el-table :data="goodsList" border>
                    <el-table-column align="center" label="图片" width="120">
                        <template slot-scope="scope">
                            <div class="img-box">
                                <img :src="scope.row.skuImage" alt="商品图片"/>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="商品编码" prop="goodsSn"></el-table-column>
                    <el-table-column align="center" label="商品名称">
                        <template slot-scope="scope">
                            <span class="present-flag" v-if="scope.row.presentFlag==1">赠品</span> {{scope.row.goodsName}}
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="供应商">
                        <template slot-scope="scope">
                            {{scope.row.merchantName?scope.row.merchantName:'自营'}}
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="商品规格" prop="goodsAttr"></el-table-column>
                    <el-table-column align="center" label="单价">
                        <template slot-scope="scope">
                            <span>{{scope.row.price | money}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="下单数量" prop="goodsNumber"></el-table-column>
                    <el-table-column align="center" label="已退款数量" prop="refundGoodsNumber"></el-table-column>
                    <el-table-column align="center" label="总价">
                        <template slot-scope="scope">
                            <span>{{Number(scope.row.price) * Number(scope.row.goodsNumber) | money}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="操作" width="120px" v-if="refundPermissionFlag && orderStatusFlag">
                        <template slot-scope="scope">
                            <el-button v-if="scope.row.goodsNumber - scope.row.refundGoodsNumber" type="danger" size="mini" @click="showRefund(scope.row)" plain>{{(info.status===2 || info.status===10)?'退款':'退货退款'}}</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-table :data="goodsMoneyList" :show-header="false" border>
                    <el-table-column align="center" label="名称" width="120" prop="name"></el-table-column>
                    <el-table-column align="right" label="金额">
                        <template slot-scope="scope">
                            <span>￥{{scope.row.money | money}}</span>
                        </template>
                    </el-table-column>
                </el-table>
                <h4 class="title">物流信息</h4>
                <el-table :data="expressList" border>
                    <el-table-column align="center" label="时间" width="200">
                        <template slot-scope="scope">
                            <span>{{formatDate(scope.row.time, 'YYYY-MM-DD HH:mm:ss')}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="信息" prop="context"></el-table-column>
                </el-table>
                <h4 class="title">预估收益</h4>
                <el-table :data="commissionList" border>
                    <el-table-column align="center" label="姓名" prop="nickname"></el-table-column>
                    <el-table-column align="center" label="手机号" prop="mobile"></el-table-column>
                    <el-table-column align="center" label="提成人等级" prop="level"></el-table-column>
                    <el-table-column align="center" label="提成类别">
                        <template slot-scope="scope">
                            <span v-if="scope.row.recommType">{{scope.row.recommType}}</span>
                            <span v-else>Lv.{{scope.row.percentageType}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="佣金比例">
                        <template slot-scope="scope">
                            <span>{{(scope.row.commissionRate*100).toFixed(2)}}</span>%
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="佣金金额">
                        <template slot-scope="scope">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
                            <span>{{scope.row.commissionPrice | money}}</span>
                            <el-button type="text"  @click="lookCommissionDetail(scope.row)">查看明细</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="实际到账时间">
                        <template slot-scope="scope">
                            <span>{{formatDate(scope.row.arrivalTime, 'YYYY-MM-DD HH:mm:ss')}}</span>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column align="center" label="状态">
                        <template slot-scope="scope">
                            <span v-text="scope.row.deleteFlag ? '有效' : '无效'"></span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="是否结算">
                        <template slot-scope="scope">
                            <span v-text="scope.row.isClearing ? '已结算' : '未结算'"></span>
                        </template>
                    </el-table-column> -->
                </el-table>
                <h4 class="title">确认收益</h4>
                <el-table :data="comfirCommissionList" border>
                    <el-table-column align="center" label="姓名" prop="nickname"></el-table-column>
                    <el-table-column align="center" label="手机号" prop="mobile"></el-table-column>
                    <el-table-column align="center" label="提成人等级" prop="level"></el-table-column>
                    <el-table-column align="center" label="提成类别">
                        <template slot-scope="scope">
                            <span v-if="scope.row.recommType">{{scope.row.recommType}}</span>
                            <span v-else>Lv.{{scope.row.percentageType}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="佣金比例">
                        <template slot-scope="scope">
                            <span>{{(scope.row.commissionRate*100).toFixed(2)}}</span>%
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="佣金金额">
                        <template slot-scope="scope">
                            <span>{{scope.row.commissionPrice | money}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="实际到账时间">
                        <template slot-scope="scope">
                            <span>{{formatDate(scope.row.arrivalTime, 'YYYY-MM-DD HH:mm:ss')}}</span>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column align="center" label="状态">
                        <template slot-scope="scope">
                            <span v-text="scope.row.deleteFlag ? '有效' : '无效'"></span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="是否结算">
                        <template slot-scope="scope">
                            <span v-text="scope.row.isClearing ? '已结算' : '未结算'"></span>
                        </template>
                    </el-table-column> -->
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="操作记录" name="2">
                <el-table :data="oprLogList" border  v-loading="pageLoading">
                    <el-table-column align="center" label="原状态">
                        <template slot-scope="scope">
                            <span v-text="states[scope.row.oldStatus]"></span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="新状态">
                        <template slot-scope="scope">
                            <span v-text="states[scope.row.newStatus]"></span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="说明" prop="remarks"></el-table-column>
                    <el-table-column align="center" label="操作人" prop="nickname"></el-table-column>
                    <el-table-column align="center" label="时间">
                        <template slot-scope="scope">
                            <span>{{formatDate(scope.row.updatedAt, 'YYYY-MM-DD HH:mm:ss')}}</span>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="退款记录" name="3">
                <el-table :data="refundOperateList" border  v-loading="refundOperateListLoading">
                    <el-table-column align="center" label="退单号" prop="refundNo" width="200"></el-table-column>
                    <el-table-column align="center" label="订单号" prop="orderNo" width="210"></el-table-column>
                    <el-table-column align="center" label="说明" prop="params"></el-table-column>
                    <el-table-column align="center" label="结果" prop="refundResult"></el-table-column>
                    <el-table-column align="center" label="操作人" width="160">
                        <template slot-scope="scope">
                            {{scope.row.name}} <br> {{scope.row.mobile}}
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="时间" width="100">
                        <template slot-scope="scope">
                            <span>{{formatDate(scope.row.createdAt, 'YYYY-MM-DD HH:mm:ss')}}</span>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
        </el-tabs>
        <div class="btn-center">
            <el-button v-if="info.status==1||info.status==5||info.status==7" type="primary" plain @click="statusRepair" :loading="btnLoading">订单状态修复</el-button>
            <el-button type="primary" plain @click="$router.back()">返回</el-button>
        </div>

        <el-dialog :title="info.status===2?'退款':'退货退款'" :visible.sync="dialogVisible">
            <el-form :model="formData" size="medium" ref="form" label-width="120px">
                <el-form-item label="订单编号:" prop="orderSn">
                    {{formData.orderNo}}
                </el-form-item>
                <template v-if="formData.refundGoodsList && formData.refundGoodsList.length">
                    <el-form-item label="商品名称:" prop="goodsName">
                        {{formData.refundGoodsList[0].goodsName}}
                    </el-form-item>
                    <el-form-item label="退款数量:" prop="goodsNumber">
                        <el-input-number v-model="formData.refundGoodsList[0].goodsNumber" @change="changeGoodsNumber" :min="1" :max="formData.refundGoodsList[0].maxGoodsNumber" label="退款数量"></el-input-number>
                        （可退数量{{formData.refundGoodsList[0].maxGoodsNumber}}件）
                    </el-form-item>
                </template>
                <el-form-item label="退款金额:" prop="refundMoney">
                    <el-input-number v-model="formData.refundMoney" placeholder="退款金额" :precision="2" :step="0.01" :max="formData.refundMaxMoney" :controls="false"></el-input-number>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="refund" :disabled="btnDisabled" :loading="btnDisabled">确定退款</el-button>
                <el-button @click="dialogVisible = false">取消</el-button>
            </div>
        </el-dialog>
        <el-dialog title="订单佣金明细" :visible.sync="dialogVisibleCommission">
          <el-table :data="commissionDetailList" border>
              <el-table-column align="center" label="图片">
                <template slot-scope="scope">
                  <img :src="scope.row.goodsImg" width="80" height="80" />
                </template>
              </el-table-column>
              <el-table-column align="center" label="商品名称" prop="goodsName"></el-table-column>
              <el-table-column align="center" label="下单数量" >
                <template slot-scope="scope">
                 {{scope.row.goodsNumber}}<span v-if="scope.row.refundNumber != 0" style="color:red;paddng-left: 6px;"> (-{{scope.row.refundNumber}})</span>
                </template>
              </el-table-column>
              <el-table-column align="center" label="预估收益" >
                 <template slot-scope="scope">
                 {{scope.row.commissionPrice}}<span v-if="scope.row.refundPrice != 0" style="color:red;paddng-left: 6px;"> ({{scope.row.refundPrice}})</span>
                </template>
              </el-table-column>
          </el-table>
        </el-dialog>
    </div>
</template>

<script>
import sha1 from 'js-sha1'
  export default {
    name: 'orderDetail',
    props: {
      id: {
        default: ''
      }
    },
    data() {
      return {
        comfirCommissionList: [],
        pageLoading: false,
        // 基本信息
        info: {},
        // 商品信息
        goodsList: [],
        goodsMoneyList: [],
        // 操作记录
        oprLogList: [],
        // 物流信息
        expressList: [],
        // 佣金列表
        commissionList: [],
        tab: '1',
        // 激活状态
        activeStatus: {
          '0': '待激活',
          '1': '已激活',
          '2': '已注销'
        },
        // 状态
        states: {
          '1': '待付款',
          '2': '待发货',
          '3': '待收货',
          '4': '已收货',
          '5': '已取消',
          '6': '付款异常',
          '7': '超时取消',
          '8': '已退款',
          '10': '待发货',
          '11': '待成团'
        },
        // 售后状态
        afterSaleStates: {
          '1': '申请中',
          '2': '审核通过',
          '3': '审核不通过',
          '4': 'E3处理中',
          '5': 'E3处理成功',
          '6': 'E3处理失败',
          '7': '退货入库成功',
          '8': '退货入库失败',
          '9': '审核物流状态中',
          '10': '审核物流状态成功',
          '11': '审核物流状态失败',
          '12': '退款处理中',
          '13': '退款成功',
          '14': '退款失败',
        },
        // 类型
        types: {
          '1': '普通',
          '2': '会员礼包',
          '3': '会员组合礼包',
          '4': '大区礼包',
          '9': '城市合伙人',
          // '11': '箱起',
          '1101': '箱起礼包',
          '1102': '箱起零售',
          '13': '新人礼包',
          '19': '3亿红包',
          '1001': 'M件N元',
          '151': '签到打卡赠品面膜',
          '22': '38元礼包',
          '25': '拼团订单',
          '202': '站外16元面膜',
          '211': '网红面膜赠品',
          '251': '网红面膜箱起'
        },
        // 会员等级
        levels: {
          '0': '普通用户',
          '1': '兰蜜',
          '2': '大区',
          '3': '董事',
        },
        loading: false,
        btnLoading: false,

        dialogVisible: false,
        btnDisabled: false,
        refundPermissionFlag: true,
        refundAllBtnFlag: false,
        orderStatusFlag: false,
        formData: {
          refundGoodsList: [],
          orderNo: '',
          refundMoney: '',
          user: {
            mobile: this.$store.getters.user.username,
            name: this.$store.getters.user.realname
          }
        },

        refundOperateList: [],
        refundOperateListLoading: true,
        hadRefundMoney: 0,

        refundList: [],
        token: 'ojojioji:;;?@#-=UFJHFUfehu!SNJHUFp[][d',
        commissionDetailList: [], // 佣金明细商品列表
        dialogVisibleCommission: false
      }
    },
    created() {
      this.getInfo()
      this.getEstimate()
      this.getComfirEstimate()
    },
    methods: {
      orderType(val) {
        let result
        if(val.type === 11 && val.activityId) {
          result = this.types['1101']
        } else if (val.type === 11 && !val.activityId) {
          result = this.types['1102']
        } else {
          result = this.types[val.type]
        }
        return result
      },
      // 获取详情
      getInfo() {
        this.pageLoading = true;
        this.request({
          url: `/bsnl-order/order/${this.$route.query.id}/load`,
          method: 'get',
          params: {
            id: this.$route.query.id
          }
        }).then(({data}) => {
          this.pageLoading = false;
          const {orderGoodsMoney, orderCommissionInfo, orderInfo, orderLogs, orderGoods, orderExpress} = data;
          this.info = orderInfo;
          this.goodsList = orderGoods ? orderGoods : [];
          orderGoods.map(item => {
            if(item.goodsNumber - item.refundGoodsNumber){
              this.refundAllBtnFlag = true;
            }
          });
          if(!([1, 5, 7, 11].includes(orderInfo.status))){
            this.orderStatusFlag = true
          }

          this.goodsMoneyList = [
            {
              name: '商品总金额',
              // money: orderGoodsMoney ? orderGoodsMoney.totalMoney : 0
              money: orderInfo ? orderInfo.goodsAmount : 0
            },
            {
              name: '等级减免金额',
              money: orderInfo.saveByMemberPrice
            },
            {
              name: '优惠券减免金额',
              money: orderInfo.couponPrice || 0
            },
            {
              name: '红包减免金额',
              money: orderInfo.saveByHongbaoPrice || 0
            },
            {
              name: '邮费',
              money: orderInfo.postage || 0
            },
            {
              name: '实付金额',
              money: orderGoodsMoney ? orderGoodsMoney.realMoney : 0
            }
          ];
          this.expressList = orderExpress && orderExpress.length && orderExpress[0].expressInfo?JSON.parse(orderExpress[0].expressInfo).data:[];
          // this.commissionList = orderCommissionInfo;
          this.oprLogList = orderLogs;
          if(orderInfo.orderNo){
            this.getRefundInfo(orderInfo.orderNo);
            this.getRefundMoney(orderInfo.orderNo);
          }
          /* if(orderInfo.expressNo){
               this.getExpress(orderInfo.expressNo);
           }*/
        }).catch(err => {
          console.log(err);
          this.pageLoading = false;
        });
      },
      getEstimate() {
        //时间挫
        var stamp = new Date().getTime()
        //随机6位数
        var nonce = Math.floor(Math.random() * 999999)
        var bb = this.token + stamp + nonce
        var sign = sha1(bb)
        this.request({
          url: '/api/commission/v1/open/Order/getOrderCommissionGroupByUserIdList',
          method: 'post',
          headers: {
            sign: sign,
            stamp: stamp,
            nonce: nonce
          },
          data: {
            orderType : this.$route.query.type,
            orderId:this.$route.query.id
          }
        }).then((res) => {
          this.commissionList = res.data
        })
      },
      // 确认预估收益
     async getComfirEstimate() {
          //时间挫
        let stamp = new Date().getTime()
          //随机6位数
        let nonce = Math.floor(Math.random() * 999999)
        let bb = this.token + stamp + nonce
        let sign = sha1(bb)
        try {
          const {data} = await this.request({
              url: '/api/commission/v1/open/Order/getOrderCommissionGroupByUserIdList', 
              method: 'post', 
              headers: {
              sign: sign,
              stamp: stamp,
              nonce: nonce
            },
            data: {
              orderType : this.$route.query.type,
              orderId:this.$route.query.id,
              ectype: false
          }})
          this.comfirCommissionList = data
          console.log('确认佣金', this.comfirCommissionList)
        } catch (error) {
          console.log(error)
        }
      },
      // 获取退款信息
      getRefundInfo(orderNo) {
        this.refundOperateListLoading = true;
        this.request({
          url: `/bsnl-order/order/refund/list?orderNo=${orderNo}`,
          method: 'get'
        }).then(({data}) => {
          this.refundOperateListLoading = false;
          this.refundOperateList = data;
        }).catch(err => {
          console.log(err);
          this.refundOperateListLoading = false;
          this.refundOperateList = [];
        })
      },
      // 获取退款总金额
      getRefundMoney(orderNo) {
        this.request({
          url: `/bsnl-order/order/had/refund/money?orderNo=${orderNo}`,
          method: 'get'
        }).then(({data}) => {
          this.hadRefundMoney = data;
        }).catch(err => {
          console.log(err);
          this.hadRefundMoney = 0;
        });
      },
      // 获取物流信息
      getExpress(expressNo) {
        this.request({
          url: '/bsnl-order/order/getExpress',
          method: 'get',
          params: {
            orderId: this.$route.query.id,
            expressNo
          }
        }).then(({data}) => {
          this.expressList = data ? data : [];
        }).catch(err => {
          this.expressList = [];
        });
      },
      // 订单状态修复
      statusRepair() {
        this.btnLoading = true;
        this.request({
          url: `/bsnl-order/order/status/revert`,
          method: 'post',
          data: {
            userName: this.$store.getters.user.username,
            mobile: "",
            orderNo: this.info.orderNo
          }
        }).then(() => {
          this.$message.success('订单状态修复成功');
          this.getInfo();
          this.btnLoading = false;
        }).catch(err => {
          console.log(err);
          this.btnLoading = false;
        });
      },
      // 显示详情
      showRefund(row) {
        // 如果购买了箱起官方100天相关商品
        if (this.info.boxGiftStatus >= 0) {
          if (this.info.boxGiftStatus === null) {
            console.log('null')
          } else if (this.info.boxGiftStatus*1 !== 2) {
            this.$message({
              message: '非已注销箱起计划100天礼包订单不能退款',
              type: 'error'
            })
            return false
          }
        }
        let refundMoney = row ? row.payPrice: parseFloat((this.goodsMoneyList[this.goodsMoneyList.length-1].money-this.hadRefundMoney).toFixed(2))
        this.formData = {
          ...this.formData,
          refundGoodsList: row ? [{
            goodsName: row.goodsName+'【'+row.goodsAttr+'】',
            orderGoodsId: row.id,
            goodsNumber: 1,
            price: row.payPrice,
            maxGoodsNumber: row.goodsNumber - row.refundGoodsNumber
          }] : [],
          orderNo: this.info.orderNo,
          refundMoney,
          refundMaxMoney: refundMoney
        };
        this.dialogVisible = true;
      },
      // 退货退款
      refund() {
        this.$refs.form.validate(valid => {
          if (!valid) {
            return false;
          }

          this.$confirm('请先在e3进行相关操作，一旦点击确定就将款直接退到用户账号，请慎重！ 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.btnDisabled = true;
            this.request({
              url: `/bsnl-goods-refund/order/${this.formData.refundGoodsList.length?'goods':'full'}/refund`,
              method: 'post',
              data: this.formData
            }).then(() => {
              this.$message.success('退款成功');
              this.dialogVisible = false;
              this.btnDisabled = false;
              this.getInfo();
            }).catch(err => {
              console.log(err);
              this.btnDisabled = false;
            });
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            });
          });
        });

      },

      changeGoodsNumber(value){
        this.formData.refundMoney = (value*this.formData.refundGoodsList[0].price).toFixed(2);
        this.formData.refundMaxMoney = (value*this.formData.refundGoodsList[0].price).toFixed(2);
      },
      // 查看预估受益详情
      lookCommissionDetail(row){
         //时间挫
        var stamp = new Date().getTime()
        //随机6位数
        var nonce = Math.floor(Math.random() * 999999)
        var bb = this.token + stamp + nonce
        var sign = sha1(bb)
        const data = {
          orderId: row.orderId,
          orderType: (this.$route.query.type && (this.$route.query.type - 0)),
          commissionUserId: row.userId
        }
        this.request({
          url: `/api/commission/v1/open/Order/getCommissionGroupByGoodsId`,
          method: 'post',
          data: data,
          headers: {
            sign: sign,
            stamp: stamp,
            nonce: nonce
          },
        }).then((res) => {
          if (res.code){
             this.commissionDetailList = res.data
             this.dialogVisibleCommission  = true
          }
        }).catch(err => {
          console.log(err);
        });
      }
    }
  }
</script>
<style lang="scss">
    @import "../../styles/mixin";
    .present-flag{
        color: #fff;
        padding: 2px 4px;
        border-radius: 4px;
        background: #eda9b5;
    }

    .order-detail{
        .title{
            @include flex;
            @include a-center;

            &>div:first-child{
                @include sub-item;
            }
            .refund-money{
                color: #c03639;
                font-size: 14px;
                margin-right: 12px;
            }
        }
    }
</style>
